Pro JavaScript Techniques by Ferguson Russ & Paxton John & Resig John

Pro JavaScript Techniques by Ferguson Russ & Paxton John & Resig John
Author: Ferguson, Russ & Paxton, John & Resig, John
Language: eng
Format: epub
ISBN: 978-1-4302-6391-3
Publisher: Apress
Published: 2015-06-23

function mouseOutHandler( e ) {

this.style.border = '0px';

e.stopPropagation();

}

// Locate, and traverse, all the elements in the DOM

var all = document.getElementsByTagName( '*' );

for ( var i = 0; i < all.length; i++ ) {

// Watch for when the user moves the mouse over the element

// and add a red border around the element

all[i].addEventListener( 'mouseover', mouseOverHandler );

// Watch for when the user moves back out of the element

// and remove the border that we added

all[i].addEventListener( 'mouseout', mouseOutHandler );